#include <DHT.h>
#include <stdlib.h>
#include <time.h>

// 定义DHT11传感器
#define DHTPIN D4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

// Generate random temperature between -40.0 and 125.0 (same as main.c)
float generate_random_temperature() {
  float temp = (float)(random(1650)) / 10.0 - 40.0; // -40.0 to 125.0
  return temp;
}

void setup() {
  // 初始化串口通信
  Serial.begin(115200);
  
  // 初始化DHT11传感器
  dht.begin();
  
  // 初始化随机数种子
  randomSeed(analogRead(0));
}

void loop() {
  // Print header (same as main.c)
  Serial.print("T: ");
  
  // Generate and print 60 temperature values (same as main.c)
  for (int i = 0; i < 60; i++) {
    float temp = generate_random_temperature();
    Serial.print(temp, 1); // Print with 1 decimal place
    
    if (i < 59) {
      Serial.print(", ");
    } else {
      Serial.print("\r\n");
    }
  }
  
  // Delay 1 second (same as main.c)
  delay(1000);
}